package hu.sulirend.model;

import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;

/**
 * Represents a lesson for a part of a Clazz with a Teacher for the Subject and the Time and Room related
 * to the Lesson object.
 *
 * @see <code>hu.sulirend.model.StudentGroup</code>
 *
 * @author <a href="mailto: peter.szilagyi@gmail.com">Peter Szilagyi</a> 
 * @since 2008
 */
@Entity
public class Lesson extends BaseEntity {

	private static final long serialVersionUID = -2070291141672768868L;
	
	private StudentGroup studentGroup;
	private Room room;
	private Time time;
	
	@ManyToOne(optional=false, fetch=FetchType.LAZY, cascade={})
	@JoinColumn(name="STUDENTGROUP_ID", referencedColumnName="id", unique=false, nullable=false, updatable=true, insertable=true)
	public StudentGroup getStudentGroup() {
		return studentGroup;
	}
	public void setStudentGroup(StudentGroup studentGroup) {
		this.studentGroup = studentGroup;
	}
	@ManyToOne(optional=false, fetch=FetchType.LAZY, cascade={})
	@JoinColumn(name="ROOM_ID", referencedColumnName="id", unique=false, nullable=false, updatable=true, insertable=true)
	public Room getRoom() {
		return room;
	}
	public void setRoom(Room room) {
		this.room = room;
	}
	@ManyToOne(optional=false, fetch=FetchType.LAZY, cascade={})
	@JoinColumn(name="TIME_ID", referencedColumnName="id", unique=false, nullable=false, updatable=true, insertable=true)
	public Time getTime() {
		return time;
	}
	public void setTime(Time time) {
		this.time = time;
	}
	
}
